<%--
  Created by IntelliJ IDEA.
  User: Peter Zhou
 
  To change this template use File | Settings | File Templates.
--%>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>


<html>
<head>
    <title>Title</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <script src="js/bootstrap.bundle.js"></script>
    <script src="js/jquery.min.js"></script>
    <script src="js/jquery.validate.min.js"></script>
    <script src="js/messages_zh.js"></script>
    <%
        //项目根路径
        String projectPath = request.getContextPath();
//获得url根路径
        String urlPath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + projectPath;

//获得项目相对路径的真实路径 D:\学习\服装购买系统\ShoppingClothes\out\artifacts\ShoppingClothes_Web_exploded\img
        String webPath = application.getRealPath("img");
    %>
</head>

<body>
<div class="container-fluid mt-3 d-flex ">
    <div class="m-auto  w-25 card   d-flex  bg-light">

        <div class="card-img m-auto d-flex"><img class="m-auto img-thumbnail " src="img/add_product.png" width="50px" height="50px"></div>
        <div class="card-title m-auto d-flex ">商品添加</div>
        <div class="card-footer m-auto ">
        <form id="addProductForm" method="post" class="m-auto" action="add_product" enctype="multipart/form-data">
            <div>
                <label class="d-flex">商品名:</label>
                <input type="text"  id="productName" name="productName">
            </div>
            <div>
                <label class="d-flex">市场价格:</label>
                <input type="text"  id="productMarketPrice" name="productMarketPrice">
            </div>
            <div>
                <label class="d-flex">价格:</label>
                <input type="text"  id="productPrice" name="productPrice">
            </div>
            <div>
                <label class="d-flex">图片:</label>
                <input type="file" id="productImage" name="productImage">
            </div>
            <div>
                <label class="d-flex">库存:</label>
                <input type="text"  id="productStock" name="productStock">
            </div>
            <div>
                <label class="d-flex">类别:</label>
                <select id="categoryId" name="categoryId">
                    <option value="1">男鞋</option>
                    <option value="2">女鞋</option>
                    <option value="3">男装</option>
                    <option value="4">女装</option>
                    <option value="5">男式表</option>
                    <option value="6">女式包</option>
                </select>
            </div>
            <div class="mt-3">
                <button class="btn btn-primary" type="submit" >立刻上传</button>
                <a class="btn btn-secondary" href="admin_index.jsp">返回首页</a>
            </div>
        </form>
    </div>
</div>
    </div>
</body>
</html>
<script>

    $().ready(function () {

        // 初始化验证
        $("#addProductForm").validate({
            rules: {
                productName:{required:true},
                productMarketPrice:{required:true},
                productPrice:{required:true},
                productImage:{required:true},
                productStock:{required:true},
                categoryId:{required:true}
            }
        });
    });
</script>